<template>
    <div class="userCenter">
        <div class="middle-body">
            <el-container>
                <el-aside style="width: 240px; overflow: hidden">
                    <div class="left">
                        <div class="avatar-img">
                            <img
                                :src="
                                    userInfo == null
                                        ? 'https://xzcs-video.oss-cn-beijing.aliyuncs.com/assets/img/avatar.png'
                                        : userInfo.avatar
                                "
                                alt
                                class="img100 cover"
                            />
                            <img
                                v-show="userInfo && userInfo.is_gpt_vip > 0"
                                src="~/assets/images/userCenter/vip-icon.png"
                                class="vip-icon"
                                alt=""
                            />
                        </div>
                        <div class="nickname">
                            {{ userInfo == null ? "" : userInfo.nickname }}
                        </div>

                        <div
                            v-if="
                                userInfo &&
                                (userInfo.is_gpt_vip != 0 ||
                                    userInfo.is_99vip == 1)
                            "
                            class="user-con-vip-wenda"
                        >
                            <!-- <template v-if="userInfo.is_99vip == 1">
                                99VIP会员
                            </template>
                            <template v-else-if="userInfo.is_gpt_vip == 1">
                                一天会员
                            </template>
                            <template v-else-if="userInfo.is_gpt_vip == 2">
                                月度会员
                            </template>
                            <template v-else-if="userInfo.is_gpt_vip == 3">
                                年度会员
                            </template> -->
                            <img
                                src="~/assets/images/userCenter/vip_two_to_one.png"
                                class="vip_two_to_one"
                                alt=""
                            />
                        </div>
                        <my-menu @getNavTitle="getNavTitle"></my-menu>
                    </div>
                    <div
                        v-show="
                            navTitle == '问答中心' || navTitle == '会员中心'
                        "
                        class="wx-gzh-con"
                    >
                        <img src="~/assets/images/index/app_code.png" alt="" />
                        <div class="wx-gzh-con-text">
                            <div class="wx-gzh-con-title">扫码下载APP</div>
                            完成小竹叶任务<br />
                            转盘抽奖好礼等你取
                        </div>
                    </div>
                </el-aside>
                <el-container>
                    <el-main style="padding: 0; margin: 0" class="right">
                        <nuxt-child v-if="pathShow"></nuxt-child>
                    </el-main>
                </el-container>
            </el-container>
        </div>
    </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from "vuex";

import myMenu from "@/components/userCenter/myMenu";
import navBj from "@/assets/images/userCenter/navBj.png";
export default {
    name: "userCenter",
    async asyncData({ params }) {},
    layout: "home",
    fetch() {},
    head() {
        return {
            title: "个人中心-【小竹财税平台】",
            meta: [],
        };
    },
    components: {
        myMenu,
    },
    props: {},
    data() {
        return {
            navBj: navBj,
            pathShow: false,
            navTitle: "",
        };
    },
    computed: {
        ...mapState("common", {
            userInfo: (state) => state.userInfo,
        }),
    },
    watch: {},
    created() {},
    mounted() {
        this.token = window.localStorage.getItem("token");
        this.removeMenuIndex("new");
        if (!this.token) {
            this.$router.push({ path: "/" });
        }
        this.getUserInfo();
        this.pathShow = true;
    },
    methods: {
        ...mapMutations("common", ["removeMenuIndex"]),
        ...mapMutations("userCenter", ["setfansFollowsIndex"]),
        ...mapActions("common", ["getUserInfo"]),
        getNavTitle(navTitle) {
            this.navTitle = navTitle;
        },
    },
};
</script>
<style lang="scss" scoped>
@import url("@/assets/static/reset.css");

.userCenter {
    background: #f0f0f2;
    // height: 1080px;
}

.top-nav {
    width: 100%;
    height: 148px;

    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.nav-box {
    //   background-color: pink;
    width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 148px;

    .left {
        position: relative;
        align-items: center;
        // z-index: -1;

        .avatar-img {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            border: 3px solid #fff;
            margin-right: 21px;

            img {
                border-radius: 50%;
            }
        }
        .name-item {
            color: #fff;

            .job-title {
                margin-top: 10px;
                font-size: 16px;
                color: #9caecc;
            }

            .icon-item {
                display: flex;
                align-items: center;
                // margin-top: -29px;

                .icon {
                    //   width: 20px;
                    height: 20px;
                    vertical-align: middle;
                }
                .level {
                    margin: 0 5px;
                    text-align: center;
                    line-height: 20px;
                    color: #fff;
                    font-size: 12px;
                    width: 39px;
                    height: 20px;
                    background: linear-gradient(
                        308deg,
                        #a1c1e6 0%,
                        #dfeeff 100%
                    );
                    border-radius: 67px;
                }

                .huiyuan {
                    width: 80px;
                    height: 24px;
                }
            }
        }
    }
    .right {
        // background-color: #fff;
        // margin-left: 10px;

        .item {
            font-weight: 400;
            display: flex;
            justify-content: center;
            flex-direction: column;
            align-items: center;
            color: #fff;
            margin: 0 25px;
            font-size: 30px;
            cursor: pointer;
        }
        .info {
            margin-top: 10px;
            margin-left: 55px;
            text-align: center;
            width: 100px;
            height: 37px;
            line-height: 37px;
            border-radius: 32px;
            border: 1px solid #cecece;
            color: #fff;
            cursor: pointer;
        }
    }
}

.middle-body {
    margin: 22px auto;
    width: 1200px;
    background: #ffffff;
    overflow: hidden;
    border-radius: 33px;

    .left {
        // margin-right: 20px;
        width: 240px;
        // min-height: 480px;
        // background: #fff;
        // border-radius: 10px;
        text-align: center;
        .avatar-img {
            width: 80px;
            margin: 0 auto;
            padding-top: 25px;
            position: relative;
            .cover {
                border-radius: 50%;
                width: 80px;
                height: 80px;
            }
            .icon {
                position: absolute;
                width: auto;
                height: 20px;
                right: 0;
                bottom: 0;
            }
            .vip-icon {
                position: absolute;
                width: 30px;
                height: 27px;
                bottom: -9px;
                left: 24px;
            }
        }
        .nickname {
            font-size: 18px;
            font-weight: 700;
            color: #333333;
            text-align: center;
            padding-top: 12px;
        }
        .icon-item {
            padding-top: 12px;
            text-align: center;
            img {
                width: 80px;
                height: auto;
            }
        }
        .user-con-vip-wenda {
            display: inline-block;
            // width: 63px;
            // box-sizing: border-box;
            margin: 0 auto;
            // text-align: center;
            // padding: 4px 6px !important;
            margin-top: 8px;
            // border-radius: 2px;
            // border: 1px solid #fa5151;
            // font-size: 12px;
            // font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
            // color: #fa5151;
            .vip_two_to_one {
                width: 64px;
                height: 20px;
                display: block;
            }
        }
    }
}

.cover {
    object-fit: cover;
}

.wx-gzh-con {
    display: flex;
    align-items: center;
    padding: 20px 22px;
    margin-top: 14px;
    background-color: #ffffff;

    img {
        width: 70px;
        height: 70px;
        margin-right: 16px;
    }
    .wx-gzh-con-text {
        font-size: 12px;
        font-family: OPPOSans, OPPOSans;
        font-weight: 400;
        color: #666666;
        line-height: 20px;
    }
    .wx-gzh-con-title {
        font-size: 16px;
        font-family: OPPOSans, OPPOSans;
        font-weight: 500;
        color: #333333;
        line-height: 20px;
        padding-bottom: 5px;
    }
    span {
        color: #ff4646;
    }
}
</style>

<style lang="scss" scoped>
::v-deep .is-active {
    border-bottom-color: white !important;
}
</style>
